<?php
include_once("../config.php");
$uid = $_GET['uid'];
$uid = str_ireplace($search, '', $uid);

$sql = "select a.id as id,a.bm as bm,a.dz as dz,a.lxr as lxr,a.tel as tel,a.xm as xm,
		a.yysj as yysj,a.tbsj as tbsj,a.status as status,a.clsj as clsj,
		a.gz as gz,a.ms as ms,a.img as img,a.xxzxyj as xxzxyj,a.bxzqm as bxzqm,
		a.wxxm as wxxm,a.zj as zj,a.wxsj as wxsj,a.wxzqm as wxzqm,
		a.xxzxqm as xxzxqm,a.shsj as shsj,a.shyj as shyj,
		a.bmid as bmid,a.xmid as xmid,a.gzid as gzid,
		a.pdsj as pdsj,a.clyj as clyj,u3.tel as gcsdh,u1.tel as tbrdh,
		u1.ming as bxr,u2.ming as xxzx,u3.ming as wxz 
		from wenti as a 
		left join user as u1 on a.uid=u1.openid 
		left join user as u2 on a.xxzx=u2.openid 
		left join user as u3 on a.wxz=u3.openid 
		where a.uid='$uid' 
		order by a.id desc limit 20";
$requ = mysqli_query($con,$sql);
$fei ='[';//费用申请被驳回
$zt = array("待审核","请修改","待维修","待接单","被拒单","待维修","费用待审","费用驳回",
			"维修完成","已撤回","已撤回","修改待审","维修完成","费用改审","被关单","","","","","","",
			"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",
			"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",
			"","","","","","","","","","","","","","","","","","","维修完成");
while($rs=mysqli_fetch_array($requ)){
	//ID，部门，地址，联系人，电话，维修项目，故障，描述，预约时间，报修时间，
	//状态代码，图片，报修人，信息中心审核人，工程师，拒单原因，派单时间，信息中心意见，
	//工程师电话，报修人电话，状态，拒单时间， 总价， 维修详情， 维修时间，工程师签名， 被修者签名，
	//部门Id，项目ID，故障ID
	$fei.='{"id":"'.$rs['id'].'","bm":"'.$rs['bm'].'","dz":"'.$rs['dz'].'",
			"lxr":"'.$rs['lxr'].'","tel":"'.$rs['tel'].'","xm":"'.$rs['xm'].'",
			"gz":"'.$rs['gz'].'","ms":"'.str_replace(PHP_EOL, '', $rs['ms']).'","yysj":"'.$rs['yysj'].'",
			"tbsj":"'.date("Y-m-d H:i:s",$rs['tbsj']).'","status":"'.$rs['status'].'",
			"img":"'.str_replace('"',"'",$rs['img']).'","bxr":"'.$rs['bxr'].'",
			"xxzx":"'.$rs['xxzx'].'","wxz":"'.$rs['wxz'].'","clyj":"'.$rs['clyj'].'",
			"pdsj":"'.date("Y-m-d H:i",$rs['pdsj']).'","xxzxyj":"'.$rs['xxzxyj'].'",
			"gcsdh":"'.$rs['gcsdh'].'","bxrdh":"'.$rs['tbrdh'].'","zt":"'.$zt[$rs['status']].'",
			"jdsj":"'.date("Y-m-d H:i:s",$rs['clsj']).'","zj":"'.$rs['zj'].'",
			"wxxm":"'.str_replace('"',"'",$rs['wxxm']).'","wxsj":"'.date("Y-m-d H:i",$rs['wxsj']).'",
			"gcsqm":"'.$rs['wxzqm'].'","bxzqm":"'.$rs['bxzqm'].'","xxzxqm":"'.$rs['xxzxqm'].'",
			"shsj":"'.date("Y-m-d H:i:s",$rs['shsj']).'","shyj":"'.$rs['shyj'].'",
			"bmid":"'.$rs['bmid'].'","xmid":"'.$rs['xmid'].'","gzid":"'.$rs['gzid'].'"
			},';
}
$fei = rtrim($fei,',');
$fei.=']';

echo '{"status":"1","msg":"ok","data":'.$fei.'}';






















